<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - entropy_encoder_model_kernel_c.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2004  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#ifndef</font> DLIB_ENTROPY_ENCODER_MODEL_KERNEl_C_
<font color='#0000FF'>#define</font> DLIB_ENTROPY_ENCODER_MODEL_KERNEl_C_

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='entropy_encoder_model_kernel_abstract.h.html'>entropy_encoder_model_kernel_abstract.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../assert.h.html'>../assert.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>iostream<font color='#5555FF'>&gt;</font>

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> eem_base
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>class</font> <b><a name='entropy_encoder_model_kernel_c'></a>entropy_encoder_model_kernel_c</b> : <font color='#0000FF'>public</font> eem_base
    <b>{</b>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> alphabet_size;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> eem_base::entropy_encoder_type entropy_encoder;
        
        <font color='#0000FF'>public</font>:

            <b><a name='entropy_encoder_model_kernel_c'></a>entropy_encoder_model_kernel_c</b> <font face='Lucida Console'>(</font>
                entropy_encoder<font color='#5555FF'>&amp;</font> coder
            <font face='Lucida Console'>)</font> : eem_base<font face='Lucida Console'>(</font>coder<font face='Lucida Console'>)</font>, alphabet_size<font face='Lucida Console'>(</font>eem_base::get_alphabet_size<font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <b>{</b><b>}</b>

            <font color='#0000FF'><u>void</u></font> <b><a name='encode'></a>encode</b> <font face='Lucida Console'>(</font>
                <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> symbol
            <font face='Lucida Console'>)</font>;
    <b>}</b>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>    <font color='#009900'>// member function definitions
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> eem_base
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> entropy_encoder_model_kernel_c<font color='#5555FF'>&lt;</font>eem_base<font color='#5555FF'>&gt;</font>::
    <b><a name='encode'></a>encode</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> symbol
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#009900'>// make sure requires clause is not broken
</font>        <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>symbol <font color='#5555FF'>&lt;</font> alphabet_size,
            "<font color='#CC0000'>\tvoid entropy_encoder_model::encode()</font>"
            <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tthe symbol must be in the range 0 to alphabet_size-1</font>"
            <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\talphabet_size: </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> alphabet_size
            <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tsymbol:        </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> symbol
            <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\tthis:          </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#0000FF'>this</font>
            <font face='Lucida Console'>)</font>;

        <font color='#009900'>// call the real function
</font>        eem_base::<font color='#BB00BB'>encode</font><font face='Lucida Console'>(</font>symbol<font face='Lucida Console'>)</font>;
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_ENTROPY_ENCODER_MODEL_KERNEl_C_
</font>

</pre></body></html>